package hud;

import javafx.scene.control.SplitPane;
import javafx.scene.control.TreeItem;
import javafx.scene.layout.VBox;

public class SplitView{
    private static SplitView instance;
    private SplitView() {

    }

    public static SplitView instance() {
        if (instance == null) {
            instance = new SplitView();
        }
        return instance;
    }
    private SplitPane splitPane;
    private TreeItem rootItem;
    private VBox viewBox;
    public SplitPane init(VBox viewBox) {
        this.viewBox = viewBox;

        splitPane = new SplitPane();
        splitPane.prefWidthProperty().bind(viewBox.widthProperty());
        splitPane.setDividerPosition(0, 0.1);

        //2.2.1 数据库列表，左方
        VBox leftVBox = DatabaseTreeView.instance().init(viewBox);

        //2.2.2 右方，tabPane
        VBox rightVBox = CollectionView.instance().init(viewBox);

        splitPane.getItems().addAll(leftVBox, rightVBox);

        return splitPane;
    }
}